import { defineComponent, reactive } from "vue";

export default defineComponent({
  props: {
    title: {
      type: String,
      required: true,
    },
    value: {
      type: Array,
      default: [],
    },
    columns: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  emits: ['cancel', 'confirm'],
  setup(props, { emit }) {
    const state = reactive({
      title: props.title,
      value: props.value,
      columns: props.columns,
    })
    return () => (
      <nut-picker title={state.title} v-model={state.value} columns={state.columns} onCancel={() => emit('cancel')} onConfirm={(e:any) => emit('confirm', e)}></nut-picker>
    )
  }
})